//
//  TestModel.m
//  MVCTest
//
//  Created by Noah on 2017/5/19.
//  Copyright © 2017年 Noah. All rights reserved.
//

#import "TestModel.h"

@interface TestModel ()
@property(strong,nonatomic)NSString *text;
@end

@implementation TestModel

-(void)editMessage:(NSString*)text{
    _text = text;
}

-(void)saveMessage{
    
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    
    [dic setObject:@"周发洪" forKey:@"name"];
    [dic setObject:@"男" forKey:@"sex"];
    if (_text!=nil) {
        [dic setObject:_text forKey:@"text"];
    }
    [user setObject:dic forKey:@"dic"];
    [user synchronize];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:KSAVESUCCESS object:dic];
}

@end
